﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using AspNetCs.Common;
using AspNetCs.Model;
using AspNetCs.Bll;

public partial class Users_HistoryArticleDetail : BasePage
{
    protected int articleId = 0;
    protected Article_Model model = new Article_Model();
    protected AspNetCs.Bll.Article bll = new AspNetCs.Bll.Article();
    protected void Page_Load(object sender, EventArgs e)
    {
       // CheckUserExit("Login.Aspx", "请您登录", true);
        if (!IsPostBack)
        {
            articleId = StringHelper.isNumber_int(Request["id"]);
            model = bll.getArticleModelByArticleID(articleId);
            ViewState["model"] = model;
            ViewState["id"] = articleId;
        }
        else
        { 
            if(ViewState["model"]!=null)
            {
                model =(Article_Model) ViewState["model"];
            }
            if (ViewState["id"] != null)
            {
                articleId = StringHelper.isNumber_int(ViewState["id"].ToString());
            }
        }
    }

    public string nextItem()
    {
        string str = "";
        DataTable dataTable = bll.nextItem(articleId);
        if(dataTable.Rows.Count>0)
        {
            str = "上一篇文章：<a href='HistoryArticleDetail.aspx?id=" + dataTable.Rows[0]["ArticleId"].ToString() + "'>" + dataTable.Rows[0]["Title"].ToString() + "</a><br>";   
        }
        return str;
    }

    public string preItem()
    {
        string str = "";
        DataTable dataTable = bll.preItem(articleId);
        if (dataTable.Rows.Count > 0)
        {
            str = "下一篇文章：<a href='HistoryArticleDetail.aspx?id=" + dataTable.Rows[0]["ArticleId"].ToString() + "'>" + dataTable.Rows[0]["Title"].ToString() + "</a><br>";
        }
        return str;
    }
}
